<?php
	function genSalt()
	{
		$salt = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
		
		return $salt;
	}
	
	function genHashPassword($input, $salt)
	{
		$hash = hash("sha256", $salt . $input);
		echo "<br/>" . $hash . "<br/>";
		$final = $salt . $hash;
		echo $final;
		
		return $final;
	}
	
	function genRandomString()
	{
		$length = 50;
		$characters = "0123456789abcdef";
		$string = "";
		for($p = 0; $p < $length; $p++)
		{
			$string .= $characters[mt_rand(0, strlen($characters) - 1)];
		}
		
		return $string;
	}
	
	function santize($data)
	{
		$data = trim($data);
		$data = htmlspecialchars($data);
		$data = mysql_real_escape_string($data);
		
		return $data;
	}